package it.sd.pwframework.admin.converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

@FacesConverter(value="aimGenericConverter")
public class GenericConverter  implements Converter {

	@Override
	public Object getAsObject(FacesContext context, UIComponent component,
			String value) {

		try {
			return ConverterUtility.deSerialize(value);
		} catch(Exception e) {
			return null;
		}
	}

	@Override
	public String getAsString(FacesContext context, UIComponent component,
			Object value) {

		try {
			return ConverterUtility.serialize(value);
		} catch(Exception e) {
			return null;
		}
		
	}
	
	

}
